home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MIDICraft's MIDINET CD-ROM
/
MIDICraft's MIDINET CD-ROM.iso
/
DOSUTILS
/
MIDISORT.DOC
< prev
next >
Wrap
Text File
|
1995-10-21
|
8KB
|
208 lines
******************************
MIDISORT v1.0
sort tracks of midi binaries
by Guenter Nagler
1995
(gnagler@ihm.tu-graz.ac.at)
******************************
[0] FEATURES
+ reads a binary midi file
+ writes a binary midi file
+ shows tracks of a binary file (title, channel, instrument)
+ user can manually assign order numbers to tracks
+ can sort by channel numbers in increasing order
+ can move comment tracks (empty tracks, tracks without notes)
behind all note playing tracks
+ keeps tempo track and format 0 track as first track
[1] BACKGROUND
I send midi songs through the Soundblaster player to a music workstation
and had some problems with some midi files. Some files played only few
voices even if the midi file contained full orchestral song.
I found that these midi files contained many tracks that did not play
something but contained text information about the author or advertisement.
My player seems to limit the number of tracks to the first 16 tracks.
That was very bad because many of the tracks were empty and other
important tracks were not played.
(Critics to Creative Labs: Why didn't you ignore short tracks that only
contain text information?)
First I used midi2txt and txt2midi converters to manually move
the comment tracks to the end of the midi file.
Then I had the idea to implement a simple program that can do that
and added some other track sorting features.
[2] FILES DESCRIPTION
MIDISORT.EXE.........sort program
MIDISORT.DOC.........this file, showing usage of MIDISORT.EXE
MIDIIO.HPP...........header file for a c++ midi parser
MIDIIO.CPP...........source code for a c++ midi parser
MTRACK.HPP...........header file for track information gathering
MTRACK.CPP...........source code for track information gathering
MIDISORT.CPP.........c++ source code for modifying midi files
MIDISORT.MAK.........make file for project
MIDISORT.CFG.........compiler options for make
MIDISORT.PRJ.........compiler project for borland c++ compilers
only MIDISORT.EXE is required to run program
[3] COPYRIGHT
MIDISORT (c) 1995 was created by Guenter Nagler.
MIDISORT is free and may be used as you wish with this one exception:
You may NOT charge any fee or derive any profit for distribution
of MIDISORT. Thus, you may NOT sell or bundle MIDISORT with any
product in a retail environment (shareware disk distribution, CD-ROM,
etc.) without permission of the author.
You may give MIDISORT to your friends, upload it to a BBS, or ftp it to
another internet site, as long as you don't charge anything for it.
[4] DISCLAIMER
MIDISORT was designed to handle 100% compatible midi files.
The midi parser was tested with 600 different midi files but I can
not say if each 100% midi compatible midi file can be correctly converted.
So I give no guarantees of the results, especially with non 100%
compatible midi files.
If you find a midi file that you think to be 100% compatible midi
that is not correctly converted, please send a sample file to
gnagler@ihm.tu-graz.ac.at .
Use MIDISORT at your own risk. Anything you do with MIDISORT is your
responsibility, and not the author's. Any damage caused to any person,
computer, software, hardware, company, or business by running MIDISORT
is your responsibility, and the author will not be liable.
If you don't understand these terms, or are not sure of something, or
are afraid something bad might come of using MIDISORT, don't use it!
You are here forewarned.
[5] INSTALLATION
[MSDOS]
Simply copy MIDISORT.EXE in a directory that is in your path.
When you start the program without arguments
[UNIX]
compile sources with your C++ compiler (e.g. GNU Compiler g++):
g++ -o midisort midisort.cpp midiio.cpp mtrack.cpp
and run program
$ midisort
C:\> MIDISORT
you should get the usage text (see next section)
[6] USAGE
usage: MIDISORT [-track] [-order # ...] [-channel] [-moveempty] srcfile.mid dstfile.mid
The parts in brackets [...] are optional.
The program MIDISORT allows following options:
-track show track information of srcfile.mid (dstfile.mid is not necessary
when using this option)
-order # ...
set order of tracks manually. This option needs one or more
track numbers between 1 and number of tracks (maximum 50)
e.g. -order 4 3 2 1
the remaining tracks follow unsorted (if only manually sorting)
-channel sort by channel numbers (option -track shows them)
channels that have no special channel number
(MULTICHANNEL or NOCHANNEL) are not sorted (use manually sorting
or option -moveempty to sort these ones).
-moveempty
moves tracks without special channel numbers to the end
(the order of these comment tracks remains as in original file)
Warning:
Do not expect that MIDISORT will produce a copy of the original
file if sorting is not used! MIDI allows to encode its commands in
different ways without changing the semantic of the notes
(It is allowed to compress the midi file by ommiting redunant command
bytes, but it is no duty).
[8] SUGGESTIONS / COMMENTS / BUG REPORTS / QUESTIONS
WWW: http://hgiicm.tu-graz.ac.at/Cpub
contains all my dos/unix midi programs
EMAIL: gnagler@ihm.tu-graz.ac.at
[9] USE
example: show tracks of the midi file example.mid
midisort -track example.mid
Track 1 [NOCHANNEL]: An example midi of format 1
Track 2 [NOCHANNEL]: sequenced by Guenter Nagler (Austria)
Track 3 [NOCHANNEL]: You find free midi programs in WWW page:
Track 4 [NOCHANNEL]: http://hgiicm.tu-graz.ac.at/Cpub
Track 5 [NOCHANNEL]: mailto:gnagler@ihm.tu-graz.ac.at
Track 6 [1]: Track01 (Marcato)
Track 7 [2]: Track02 (SynChiff)
Track 8 [3]: Track03 (SynthBass1)
Track 9 [4]: Track04 (Bass&Lead)
Track 10 [5]: Track05 (Vibes)
Track 11 [NOCHANNEL]:
Track 12 [10]: Track09 (Drums)
Track 13 [10]: Track10 (Drums)
Track 14 [10]: Track11 (Drums)
Track 15 [12]: Track12 (Seashore)
example: move comment tracks to end of a midi file (symptoms: only few
of the tracks are played)
midisort -moveempty example.mid sorted.mid
The result tracks of sorted.mid will be:
Track 1 [NOCHANNEL]: An example midi of format 1
Track 2 [1]: Track01 (Marcato)
Track 3 [2]: Track02 (SynChiff)
Track 4 [3]: Track03 (SynthBass1)
Track 5 [4]: Track04 (Bass&Lead)
Track 6 [5]: Track05 (Vibes)
Track 7 [10]: Track09 (Drums)
Track 8 [10]: Track10 (Drums)
Track 9 [10]: Track11 (Drums)
Track 10 [12]: Track12 (Seashore)
Track 11 [NOCHANNEL]: sequenced by Guenter Nagler (Austria)
Track 12 [NOCHANNEL]: You find free midi programs in WWW page:
Track 13 [NOCHANNEL]: http://hgiicm.tu-graz.ac.at/Cpub
Track 14 [NOCHANNEL]: mailto:gnagler@ihm.tu-graz.ac.at
Track 15 [NOCHANNEL]:
As you see, the first track (tempo track) will never be moved!
example: sort example.mid tracks manually in reverse order and
move empty tracks to end
midisort -order 15 14 13 12 10 9 8 7 6 -moveempty example.mid sorted.mid
Track 1 [NOCHANNEL]: An example midi of format 1
Track 2 [12]: Track12 (Seashore)
Track 3 [10]: Track11 (Drums)
Track 4 [10]: Track10 (Drums)
Track 5 [10]: Track09 (Drums)
Track 6 [5]: Track05 (Vibes)
Track 7 [4]: Track04 (Bass&Lead)
Track 8 [3]: Track03 (SynthBass1)
Track 9 [2]: Track02 (SynChiff)
Track 10 [1]: Track01 (Marcato)
Track 11 [NOCHANNEL]: sequenced by Guenter Nagler (Austria)
Track 12 [NOCHANNEL]: You find free midi programs in WWW page:
Track 13 [NOCHANNEL]: http://hgiicm.tu-graz.ac.at/Cpub
Track 14 [NOCHANNEL]: mailto:gnagler@ihm.tu-graz.ac.at
Track 15 [NOCHANNEL]: